package iedcyt.acute.model;

import java.util.HashMap;
import iedcyt.acute.utils.configuration.Configuration;

public class ConfigurationModel {
	
	private boolean changed;
	private HashMap<String, String> properties;
	
	public ConfigurationModel() {
		properties = new HashMap<String,String>();
		properties = Configuration.getInstance().getAllProperties();
			
		changed = false;
	}
	
	public void setProperties(HashMap<String, String> props) {
		this.properties = props;
	}
	public HashMap<String, String> getProperties() {
		return properties;
	}
	public void setChanged(boolean changed) {
		this.changed = changed;
	}
	public boolean isChanged() {
		return changed;
	}

	public void changeKeyData(String key, String value) {
		properties.put(key, value);
		changed = true;
		
	}

	public void save() {
		
		for (String key : properties.keySet()) {
			Configuration.getInstance().setProperty(key, properties.get(key));
		}
		
		Configuration.getInstance().saveProperties();
		
	}
	

}
